<?php
//--------------------------------------------------
//	Filename: timezoney_select.php
//--------------------------------------------------
//		Information:
// Include this file to print a selection box for 
// selecting timezone.
//--------------------------------------------------
if( !defined('IN_INDEX') )
{
	die('The content of this page is hidden.');
}
$selected_timezone = "";
if(isset($preselected_timezone))
{
	$selected_timezone = $preselected_timezone;
}

// Drop down list for selecting country. Selections availible are stored in $COUNTRY_LIST.
echo "<select name=\"timezone_list\">\n
	<option value=\"-\">" . ucfirst(translate('timezone')) . "</option>\n";
foreach($TIME_ZONES as $key => $val)
{										
	$text_gmt = "";
	$pos = stripos($val['gmt'], '.');
	if($pos > 0)
	{
		$gmt_hour = substr($val['gmt'], 0, $pos);
		$gmt_min = substr($val['gmt'], $pos+1);
	}
	else
	{
		$gmt_hour = $val['gmt'];
		$gmt_min = '00';
	}
	
	
	if($gmt_min == '5')
	{
		$gmt_min = '30';
	}
	else if($gmt_min == '75')
	{
		$gmt_min = '45';
	}
	else
	{
		$gmt_min = '00';
	}
	if($gmt_hour == 0 && $gmt_min == '00')
	{
		$text_gmt = "(GMT)";
	}
	else
	{
		if(substr($gmt_hour, 0, 1) != '-')
		{
			$text_gmt = '(GMT +' . $gmt_hour . ":" . $gmt_min . ')';
		}
		else
		{
			$text_gmt = '(GMT ' . $gmt_hour . ":" . $gmt_min . ')';
		}
	}
	
	if($val['gmt'] == $selected_timezone)
	{
		echo "<option value=\"" . $val['gmt'] . "\" selected=\"selected\">" . $text_gmt . " " . $val['text'] . "</option>\n";
	}
	else
	{
		echo "<option value=\"" . $val['gmt'] . "\">" . $text_gmt . " " . $val['text'] . "</option>\n";
	}
}
echo "</select>\n";
?>